<div id="reMsg" style="display: none; padding:3px 10px; border: 1px solid #cc0000;margin: 3px 0 5px;"></div>
<div id="getCommentsForm">
    <form name="([$comfrm.name])" id="([$comfrm.name])" action="([$comfrm.action])" method="([$comfrm.method])">
        <table class="outer">
        	([foreachq item=item from=$comfrm.elements])
        	([if !$item.hidden])
        	<tr>
        		<td valign="top">([$item.caption])([if $item.required])<em>*</em>([/if])</td>
        		<td style="padding: 3px 0;">([$item.body])</td>
        	</tr>
        	([else])
        	([$item.body])
        	([/if])
        	([/foreach])
        </table>
       
    </form>
</div>

<script type="text/javascript">
	$(document).ready(function(){
	    $("#comfrm").submit( function() {
	        $("div[id=reMsg]").html("<img src=\"images/loading.gif\" alt=\"\" />").show();
	        $("div[id=getCommentsForm]").hide();
	        var data = $("#comfrm").formToArray();
	        var url = $(this).attr("action");
	        var getlisturl = "([$comurl])";
	        $.ajax({
				type: "POST",
				url: url,
				data:   data,
				success: function(msg){ 
					if ( msg ) {
					    $("div[id=reMsg]").html("([$smarty.const._CM_SAVE_SUCCEED])").show();
					    getCommentList(getlisturl);
					} else {
					    $("div[id=reMsg]").html("([$smarty.const._CM_SAVE_FAILED])").show();
					    $("div[id=getCommentsForm]").show();
					}
				} 
			}); 
	        return false;
	    });
	})
</script>